﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using BPM.Foundation.PWDB;


namespace BPM.Base.WFLib
{
	public partial class frmUser: Form
	{
        public string Value;
		public frmUser()
		{
			InitializeComponent();
		}

        private void frmUser_Load(object sender, EventArgs e)
        {
            FillUser();
        }

        private void FillUser()
        {
           List<PW_User>  list= pws.getPWS().searchUser("",null,1).ToList();
           list.ForEach(p => p.firstName = p.firstName + p.lastName + ":" + p.userNo);

           this.lbUser.DataSource = list;
           this.lbUser.DisplayMember = "firstName";
           this.lbUser.ValueMember = "userNo";
        }

        private void btnOK_Click(object sender, EventArgs e)
        {
            PW_User user = this.lbUser.SelectedItem as PW_User;
            this.Value = string.Format("{0}|{1}", user.userNo, user.firstName);
            this.Hide();

        }
	}
}
